using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using way.util;

namespace way.model
{
    public class Result<T>
    {
        public T data { get; set; }
        public ResultCode status { get; set; }
        public string message { get; set; }
        public string database { get; set; }
        public string table { get; set; }
        public int id { get; set; }
        public string schema { get; set; }
        public List<MenuEntity> menuHeads { get; set; }
        //public List<MenuEntity> list { get; set; }

        public Result<T> setStatus(ResultCode code, string message) {
            this.status = code;
            this.message = message;
            return this;
        }
        public Result<T> setStatus<T1>(Result<T1> res)
        {
            this.status = res.status;
            this.message = res.message;
            return this;
        }
        public Result<T> setStatus(ResultCode code)
        {
            this.status = code;
            return this;
        }
        public bool check() {
           return !ResultCodeExtensions.IsSuccess(this.status);
        }
    }
}
